package com.qqcy.authservice.util;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * DATE: 2022/1/11
 * Author: huhuan
 */
public class PropertiesUtil {
    private String fileName;
    private Properties properties;

    public PropertiesUtil(String fileName){
        this.fileName = fileName;
        properties = new Properties();
        try{
            InputStream is =PropertiesUtil.class.getClassLoader().getResourceAsStream(this.fileName);
            InputStreamReader isr = new InputStreamReader(is,"utf-8");
            properties.load(isr);
            is.close();;
            isr.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     *通过key获取对应的key
     * @param key
     * @return
     */
    public String getPropertyValue(String key){
        return properties.getProperty(key);
    }

    public static void main(String[] args) {
        JwtUtil jwtUtil = new JwtUtil();
        System.out.println(jwtUtil.parseJwt(jwtUtil.createJwt("1")));
    }
}
